package top.aicey.ai.sparring.listener;

import com.google.common.base.Joiner;
import top.aicey.ai.sparring.common.holder.SparringConfigProperties;
import top.aicey.ai.sparring.processor.NameGenerateProcessor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.Map;

@Component
public class DefaultReportProcessorSelector implements ReportProcessorSelector,NameGenerateProcessor {

    @Autowired
    private Map<String, ReportProcessor> reportProcessorMap;

    @Autowired
    private SparringConfigProperties properties;

    @Override
    public ReportProcessor get() {
        return reportProcessorMap.get(generate());
    }

    @Override
    public String generate() {
        return Joiner.on("").join(properties.getMode(), ReportProcessor.class.getSimpleName());
    }
}
